#Author: Guangfu Wang.

## if conan.cmake is not existing in specified folder, downloading it from github.
function(download_conan_file_if_not_exist dir_)
    if(NOT EXISTS "${dir_}/conan.cmake")
        message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
        file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/v0.16.1/conan.cmake"
            "${dir_}/conan.cmake"
            EXPECTED_HASH SHA256=396e16d0f5eabdc6a14afddbcfff62a54a7ee75c6da23f32f7a31bc85db23484
            TLS_VERIFY ON)
        message(STATUS "Downloading conan.cmake: Done")
    endif(NOT EXISTS "${dir_}/conan.cmake")

    include(${dir_}/conan.cmake)
endfunction(download_conan_file_if_not_exist dir_)

